using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class TimeDisplay : MonoBehaviour
{
    private TMP_Text timeText;

    private void Awake()
    {
        timeText = GetComponent<TMP_Text>();
        InvokeRepeating("UpdateTime", 0f, 1f); // 每秒更新一次时间
    }

    private void UpdateTime()
    {
        DateTime now = DateTime.Now;
        string timeString = now.ToString("HH:mm:ss");
        timeText.text = timeString;
    }
}
